Skip to content

fix(mcpx): gate form elicitation on the declaration sub-keys (#1757) - #2162

Merged
dezren39 merged 1 commit into
mainfrom
queue/2004-1757-elicit-form-gate
Oct 29, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/2004-1757-elicit-form-gate

Conversation

@dezren39

@dezren39 dezren39 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes the form portion of #1757 (Phase 3a of #1753), per triage task 1980. Queue task 2004.

Change (pkgs/mcpx/internal/mcpserver/conn.go, CanElicit): the form branch no longer returns true for any elicitation declaration. At peer revision ≥ 2025-11-25 it parses the declaration — form is sendable iff a form key is present or the declaration is empty ({} is the form-only declaration); a url-only declaration is not form-capable, and a malformed declaration reads as undeclared (mirroring the url branch). Below 2025-11-25, presence of the capability remains the form declaration, unchanged. The url branch, roots behaviour and upstream declarations are untouched; AnswersInline inherits the corrected answer via CanElicit("form").

Sequencing: gated on Phase 1 (PR #2003, same file) — that PR merged 2026-10-29T05:48Z, and this branch is based on current main including it. No parallel conn.go edit.

Tests: the declaration matrix in proto_test.go gains six cases — url-only refused at 2025-11-25+, form-only, both keys, {} (form allowed), legacy 2025-06-18 url-only (form allowed), malformed (undeclared). Full suite runs in CI (go test ./... for pkgs/mcpx).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

CanElicit("form") returned true for any elicitation declaration, so a
2025-11-25+ host that declared only url mode was offered form
elicitations with a requestedSchema it never agreed to. From
2025-11-25 the form branch now parses the declaration: form is
sendable iff a form key is present or the declaration is empty ({}
is the form-only declaration); url-only is not form-capable and a
malformed declaration reads as undeclared. Below 2025-11-25 presence
of the capability remains the form declaration, unchanged.

Phase 3a of #1753 (form portion of #1757), per triage task 1980.
Lands on top of merged PR #2003 (Phase 1 sampling gate, same file).
Tests: declaration matrix extended in proto_test.go (url-only
refused at 2025-11-25+, form-only, both keys, {}, legacy, malformed).
@dezren39
dezren39 requested a review from a team as a code owner October 29, 2026 06:58
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0584a955-7789-4d39-bec0-6c071122098e
Commits

Reviewing files that changed from the base of the PR and between b2b885b and 955afec.

Files selected for processing: 2
  • pkgs/mcpx/internal/mcpserver/conn.go
  • pkgs/mcpx/internal/mcpserver/proto_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T07:02:19.104221Z 955afec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 955afec19e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if json.Unmarshal(p.Caps["elicitation"], &e) != nil {
return false
}
return len(e.Form) > 0 || len(e.URL) == 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inline routing for URL-only clients

For a client on revision 2025-11-25 or later that declares only elicitation.url and no sampling, this change also makes AnswersInline() return false because it checks only CanElicit("form") || CanSample(). Consequently, canAsk in ask.go rejects the client and the request handlers bypass viaAsk, so supported URL questions are no longer relayed to that client, even though CanElicit("url") still returns true. Keep the stricter form check, but also include URL capability in AnswersInline() so URL-only clients retain their supported elicitation flow.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant